using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace MedicalSystem.SamrtReport.Library
{
   public class CustomFormHepler
    {
       public static void ShowForm(Form form)
       {
           form.Opacity = 0;
           Timer timer = new Timer();
           timer.Interval = 25;
           timer.Tick += delegate
           {
               if (form.Opacity != 1)
               {
                   form.Opacity = form.Opacity + 0.1;
               }
               else
               {
                   timer.Stop();
                   timer.Dispose();

               }
           };
           timer.Start();
       }
       public static void CloseForm(Form form)
       {
           CloseForm(form, DialogResult.Cancel);
       }
       public static void CloseForm(Form form, DialogResult dialogResult)
       {
           Timer timer = new Timer();
           timer.Interval = 25;
           timer.Tick += delegate
           {
               if (form.Opacity != 0)
               {
                   form.Opacity = form.Opacity - 0.1;
               }
               else
               {
                   timer.Stop();
                   timer.Dispose();
                   form.DialogResult = dialogResult;
               }
           };
           timer.Start();
       }
    }
}
